package com.kexio.file.config;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.kexio.file.service.StorageStrategyFactory;
import com.kexio.file.storage.StorageStrategy;

/**
 * 文件服务配置类
 * 
 * @author kexio
 */
@Configuration
@EnableConfigurationProperties(FileServiceProperties.class)
public class FileServiceConfiguration {

    @Autowired
    private List<StorageStrategy> storageStrategies;

    /**
     * 存储策略工厂
     */
    @Bean
    public StorageStrategyFactory storageStrategyFactory() {
        return new StorageStrategyFactory(storageStrategies);
    }
}
